package com.charm.nukaties.transaction

import com.billy.cc.core.component.CC
import com.billy.cc.core.component.CCResult
import com.billy.cc.core.component.IComponent

class ComponentTransaction : IComponent {
    override fun onCall(cc: CC?): Boolean {
        val actionName = cc!!.actionName
        when (actionName) {
            "getTransactionFragment" -> getTransactionFragment(cc)
        }
        return false
    }

    private fun getTransactionFragment(cc: CC) {
        CC.sendCCResult(
                cc.callId,
                CCResult.success("fragment", TransactionFragment())
                        .addData("int", 1)
        )
    }

    override fun getName(): String {
        return "transaction"
    }

}